package com.daling.product_processor.common;

public enum CodeEnum {
    SUCCESS(1000, "成功"),
    FAIL(2000, "失败");

    private Integer code;
    private String msg;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    CodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public static String getMsgByCode(Integer code) {
        CodeEnum[] ces = values();
        for (CodeEnum ce : ces) {
            if (ce.code.equals(code)) {
                return ce.msg;
            }
        }
        return null;
    }
}
